Derivation of Deterministic Inverse Programs Based on LR Parsing
نویسندگان
چکیده
We present a method for automatic program inversion of functional programs based on methods of LR parsing. We formalize the transformation and illustrate it with the inversion of a program for runlength encoding. We solve one of the main problems of automatic program inversion—the elimination of nondeterminism—by viewing an inverse program as a context-free grammar and applying to it methods of LR parsing to turn it into a recursive, deterministic inverse program. This improves the efficiency of the inverse programs and greatly expands the application range of our earlier method for program inversion.
منابع مشابه
Strict Deterministic Aspects of Minimalist Grammars
The Minimalist Grammars (MGs) proposed by Stabler(1997) have tree-shaped derivations (Harkema, 2001b; Michaelis, 2001a). As in categorial grammars, each lexical item is an association between a vocabulary element and complex of features, and so the “yields” or “fringes” of the derivation trees are sequences of these lexical items, and the string parts of these lexical items are reordered in the...
متن کاملDeterministic Parsing And Unbounded Dependencies
This paper assesses two new approaches to deterministic parsing with respect to the analysis of unbounded dependencies (UDs). UDs in English are highly locally (and often globally) ambiguous. Several researchers have argued that the difficulty of UDs undermines the programme of deterministic parsing. However, their conclusion is based on critiques of various versions of the Marcus parser which ...
متن کاملA New Approach to the Construction of Generalized LR Parsing Algorithms
LR parsing strategies can analyze LR grammars, which are deterministic. If we consider LR parsing tables in which each entry can contain several actions, we obtain non-deterministic LR parsing, often known as generalized LR parsing, which can analyze non-deterministic context-free grammars. It this context, some mechanism is needed in order to represent the non-deterministic evolution of the st...
متن کاملUnifying LL and LR parsing
In parsing theory, LL parsing and LR parsing are regarded to be two distinct methods. In this paper the relation between these methods is cla-riied. As shown in literature on parsing theory, for every context-free grammar, a so-called non-deterministic LR(0) automaton can be constructed. Here, we show, that traversing this automaton in a special way is equivalent to LL(1) parsing. This automato...
متن کاملOn LR(k)-Parsers of Polynomial Size
Usually, a parser for an LR(k)-grammar G is a deterministic pushdown transducer which produces backwards the unique rightmost derivation for a given input string x ∈ L(G). The best known upper bound for the size of such a parser is O(2|G||Σ| +k log |Σ|+log |G|) where |G| and |Σ| are the sizes of the grammar G and the terminal alphabet Σ, respectively. If we add to a parser the possibility to ma...
متن کامل